package com.atguigu.gulimail.search.controller;

import com.atguigu.gulimail.search.Service.MallSearchService;
import com.atguigu.gulimail.search.Vo.SearchParam;
import com.atguigu.gulimail.search.Vo.SearchResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Slf4j
@Controller
public class SearchController {

    @Autowired
    MallSearchService mallSearchService;

    @GetMapping("/list.html")
    public String listPage(SearchParam param, Model model){
        SearchResult serarch = mallSearchService.serarch(param);
        model.addAttribute("result",serarch);
        log.info(serarch.toString());
        return "list";
    }

}
